IdeaBlade DevForce 2010 Help Reference
EntitySpan Constructor(EntityRelationLink[])
See Also  Example Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntitySpan Class > EntitySpan Constructor : EntitySpan Constructor(EntityRelationLink[])



Initializes a new instance of the EntitySpan class.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal ParamArray entityRelationLinks() As EntityRelationLink _
)
Visual Basic (Usage)Copy Code
Dim entityRelationLinks() As EntityRelationLink
 
Dim instance As New EntitySpan(entityRelationLinks)
C# 
public EntitySpan( 
   params EntityRelationLink[] entityRelationLinks
)
C++/CLI 
public:
EntitySpan( 
   ... array<EntityRelationLink^>^ entityRelationLinks
)

Parameters

entityRelationLinks
One or more entity relation links

Exceptions

ExceptionDescription
System.ArgumentExceptionThrown if the relationships do not connect

Example

C#Copy Code
public void FindEntityGraph() {

  DomainModelEntityManager mgr = new DomainModelEntityManager();
  
  // Preload some data into cache for this example.
  var emp = mgr.Employees.Where(e => e.Id == 1).Include("OrderSummaries.OrderDetails.Product").ToList().First();

  // Get an order for this example.
  OrderSummary anOrder = mgr.FindEntities<OrderSummary>(EntityState.Unchanged).First();


  // Now retrieve an object graph for the selected order.
  var roots = new List<Entity> { anOrder };

  // Add spans - we want a) employee for the order, and b) order details and their products.
  // This requires 2 spans.
  EntitySpan span1 = new EntitySpan(EntityRelations.FK_OrderSummary_Employee.ToRole1Link);
  EntitySpan span2 = new EntitySpan(EntityRelations.FK_Order_Details_Orders.ToRole2Link,
    EntityRelations.FK_Order_Details_Products.ToRole1Link);
  var spans = new List<EntitySpan> { span1, span2 };

  // Get entity graph.
  var entityGraph = mgr.FindEntityGraph(roots, spans, EntityState.Unchanged);
}

Remarks

A single EntitySpan represents the relations among a graph of entities. You must be able to "walk" the spans without jumping or backtracking.

The EntitySpan is used in retrieving an entity graph with EntityManager.FindEntityGraph

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.